// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const LL MOD = 998244353;

LL n, m, L, R;

LL bin(LL a, LL b, LL p = MOD) {
    LL res = 1;
    a = (a + p) % p;
    for (a%=p; b; b>>=1, a=a*a%p)
        if (b & 1)
            res = res * a % p;
    return res;
}

LL inv(LL a, LL p = MOD) {
    return bin(a, p-2, p);
}

int main(int argc, char const *argv[]) {
    // code
    cin >> n >> m >> L >> R;
    LL k = R - L + 1;
    LL x = k/2, y = k-x;
    // dbg(x, y, n, m);
    const LL inv2 = (MOD+1)/2;
    LL ans = (bin(x+y, n*m) + bin(y-x, n*m)) * inv2 % MOD;
    if (n * m % 2)
        ans = bin(k, n*m);
    cout << ans << endl;
    return 0;
}
